diff --git a/Twitter-Data-Analysis/extract_twitter_data.py b/Twitter-Data-Analysis/extract_twitter_data.py index b2558dd..178df35 100644 --- a/Twitter-Data-Analysis/extract_twitter_data.py +++ b/Twitter-Data-Analysis/extract_twitter_data.py @@ -28,7 +28,7 @@ class MyListener(StreamListener): def on_data(self, data): try: - with open('C:\\Users\\ujjwal.karn\\Desktop\\Tweets\\python.json', 'a') as f: #change location here + with open('location/file_name.txt', 'a') as f: #change location here f.write(data) return True except BaseException as e: diff --git a/basic_commands.py b/basic_commands.py index b15d929..8c401fc 100644 --- a/basic_commands.py +++ b/basic_commands.py @@ -1,5 +1,5 @@ >>> a = ['a', 'b', 'c', 'd', 'e'] ->>> for index, item in enumerate(a): print index, item +>>> for index, item in enumerate(a): print index, item # enumerate function will generate an index for the item + item it self. ... 0 a 1 b @@ -37,6 +37,7 @@ str1 = "this is string example....wow!!!"; str2 = "exam"; +# find function will print the position for the first character of the string if it's found! print str1.find(str2); print str1.find(str2, 10); print str1.find(str2, 40);