Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import timeit
- # def inside():
- s = '''
- new={}
- with open('1.txt', 'r') as f:
- sequence = f.read()
- for i in sequence:
- new[i]=i
- '''
- # def outside():
- p = '''
- new={}
- with open('1.txt', 'r') as f:
- sequence = f.read()
- for i in sequence:
- new[i]=i
- '''
- print(timeit.timeit(stmt=s, number=1_000))
- print(timeit.timeit(stmt=p, number=1_000))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement