Python
Module
- File
- JSON
- System
Variable
var1 = "Hello"
print(var1)
Condition
test = False
if not test and True:
print("Hello world")
else:
print("Never print")
Loop
some_data = ["test","testing","foo"]
for i,val in enumerate(some_data):
print(str(i) + "-" + val)
File
Read
# Read each line of a file and store the result
result = []
with open(filename) as domains:
results = domains.read().splitlines()
# Read all the file and store it
file = open('testfile.text', 'r')
print file.read()