- Introduction of Twitter API
- Useful library for python analysis
- learn the basic of python3
* Here is the highlight of YouTube tutorial.
In this tutorial, you can overview how the remote server works with python
controlled by iPhone. Twitter API would be one of the examples.
The basic skill is very useful for many purposes so let's learn it with
Mac PC already has python2. Please try to output the following letter,
jplet = "777"
If you are not English speaker like me, I would definitely recommend you
to use python3 rather than python2 because it would not work well with
foreign letter such as Japanese.
After you install it, try the following command to execute python3.
One of the attractive points about python would be you can import many
kinds of library. Here is the example to import CSV.
with open('data/csvtest.csv') as f:
.reader = csv.reader(f)
.for row in reader:
With this code, you can read the csv file from the designated path and
covert the data into the array easily.
As for python grammer, indent is the most important part that you should
cq = 'app'
if cq == 'apps':
.print( 'Catch Questions' )
.print( 'CQ Academy' )
For loop statement, please be careful about the indent. Only one mistake
would not work the whole system. This feature is very different from Swift.
for i in range(5):
strings = ['Catch', 'Questions', 'Academy', 'Cat', 'App']
for string in strings:
.if string == 'Cat':
On the other hand, to pass the data you input, the following html code
<meta http-equiv="Content-Type" content="text/html;
<form name="Form" method="POST" action="../myDirectory/twtAnalysis.cgi">
Search: <input type="text" size="30" name="name">
<input type="submit" value="submit" name="button">
You can post the particular key word for Twitter analysis cgi. To get the
information, use the following library and code.
form = cgi.FieldStorage()
sentName = form.getvalue('name','')
To analyze twitter, I used the followings;
from requests_oauthlib import OAuth1Session
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
This tutorial is for beginners so at the advanced lesson, I will show you
how they work.
To get the source code, check the comment of my YouTube
Back to Table List