Skip to content

Commit 3a98fcc

Browse files
committed
final changes
1 parent 0ceec53 commit 3a98fcc

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

MyFile.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is sample text

file2.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from datetime import date,timedelta
1717
today = date.today() - timedelta(days=1)
1818
today_minus_8=date.today() - timedelta(days=8)
19-
print today_minus_8
19+
print(today_minus_8)
2020

2121
last_seven_days=[]
2222
seven_forteen_days=[]
@@ -26,8 +26,8 @@
2626
for i in range(8,15):
2727
seven_forteen_days.append(date.today() - timedelta(days=i))
2828

29-
print last_seven_days
30-
print seven_forteen_days
29+
print(last_seven_days)
30+
print(seven_forteen_days)
3131
# outlet/date/camerano/
3232
# df=pd.DataFrame()
3333
datalist=[]
@@ -39,8 +39,8 @@
3939
# print object_summary.key
4040
# break
4141

42-
print count
42+
print(count)
4343

4444
except Exception as e:
45-
print e
46-
print 'Error on line {}'.format(sys.exc_info()[-1].tb_lineno)
45+
print(e)
46+
print('Error on line {}'.format(sys.exc_info()[-1].tb_lineno))

python2.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# from file2 import *
2-
import os
31

2+
# step1=assign a variable with python2 text
3+
# step2=make a file2.py with this text
4+
# step3=convert with the 2to3 module within the code
5+
# step4= extract the text from the converted file
6+
import os
47
python2='''
58
import sys
69
try:
@@ -49,33 +52,25 @@
4952
print 'Error on line {}'.format(sys.exc_info()[-1].tb_lineno)
5053
'''
5154

52-
5355
myVar="file2"
5456

5557
x = open (myVar+".py", "w")
5658
x.write(python2)
5759
x.close()
58-
59-
60+
os.system("Echo Hello World")
61+
os.system("echo This is sample text > MyFile.txt")
62+
os.system("2to3 -w file2.py")
63+
# Note for Devops:Running this os.system(2to3 -w file2.py) command in virtual environment
6064
# Run 2to3 file2.py
6165

62-
63-
64-
# step1=assign a variable with python2 text
65-
# step2=make a file2.py with this text
66-
# step3=convert with the 2to3 module within the code
67-
# step4= extract the text from the converted file
68-
6966
python3=''' '''
7067
a="file2.py"
7168
filetoopen=open(a,'r')
7269
line=filetoopen.readline()
7370

7471
while(line!=""):
75-
# print(line)
7672
python3=python3+line
7773
line=filetoopen.readline()
78-
7974
filetoopen.close()
8075
print (python3)
8176

0 commit comments

Comments
 (0)