-
Notifications
You must be signed in to change notification settings - Fork 1
/
scripts.py
30 lines (25 loc) · 871 Bytes
/
scripts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
how_many_snakes = 1
snake_string = ("\n"
"Welcome to Python3!\n"
"\n"
" ____\n"
" / . .\\\n"
" \ ---<\n"
" \ /\n"
" __________/ /\n"
"-=:___________/\n"
"\n"
"<3, Juno\n")
print(snake_string * how_many_snakes)
# to read a file
f = open('name.txt', 'r')
file_data = f.read()
print(file_data)
f.close()
# to write in a file
f = open('name.txt', 'w')
file_data = f.write("this is scripting in python.")
print(file_data)
f.close()
'''Importing Local Scripts.
We can actually import Python code from other scripts, which is helpful if you are working on a bigger project where you want to organize your code into multiple files and reuse code in those files'''