Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # Do `echo 0 > ~/visits.txt` before serving
- with open('../../visits.txt', 'r+') as f:
- visits = int(f.read()) + 1 # Read visit count, increment
- f.seek(0)
- f.write(str(visits)) # Save visit count
- # Write response!
- print('Content-Type: text/plain')
- print('Cache-Control: no-cache')
- print()
- print(visits)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement