Python 3.6 (The best is to use virtuall environment)
- function intro
- Built in functions
| <?php | |
| // for data add | |
| function add_data($id,$name,$phone){ | |
| $data = sprintf('%10d%60s%15s',$id,$name,$phone); | |
| $file = fopen('db.txt','a'); | |
| fwrite($file,$data); | |
| fclose($file); | |
| } | |
| import subprocess as sp | |
| def add_data(id_,name,phone): | |
| data = "{:10d}{:60s}{:15s}".format(id_,name,phone) | |
| print(data) | |
| file = open('db.txt','a') | |
| file.write(data) | |
| file.close() | |
| def show_data(): | |
| file = open('db.txt','r') |
| <?php | |
| // for data add | |
| function add_data($id, $name, $phone) | |
| { | |
| $data = sprintf('%10d%60s%15s', $id, $name, $phone); | |
| $file = fopen('db.txt', 'a'); | |
| fwrite($file, $data); | |
| fclose($file); | |
| } |
| import subprocess as sp | |
| def add_data(id_,name,phone): | |
| data = "{:10d}{:60s}{:15s}".format(id_,name,phone) | |
| print(data) | |
| file = open('db.txt','a') | |
| file.write(data) | |
| file.close() | |
| def get_data(): | |
| students = [] |
| # this is for a simple quiz system using python based on web crolling | |
| # importent link | |
| # request: http://docs.python-requests.org/en/master/ | |
| # beautiful soup: https://www.crummy.com/software/BeautifulSoup/bs4/doc/ | |
| # digital ocean tutorial: https://www.digitalocean.com/community/tutorials/how-to-scrape-web-pages-with-beautiful-soup-and-python-3 | |
| from bs4 import BeautifulSoup | |
| import requests |
| """ | |
| importent links: | |
| http://sebastianraschka.com/Articles/2014_sqlite_in_python_tutorial.html | |
| http://www.pythoncentral.io/introduction-to-sqlite-in-python/ | |
| """ | |
| import sqlite3 |
| """ | |
| importent links: | |
| http://sebastianraschka.com/Articles/2014_sqlite_in_python_tutorial.html | |
| http://www.pythoncentral.io/introduction-to-sqlite-in-python/ | |
| """ | |
| import sqlite3 |
| import datetime | |
| import requests | |
| import xml.etree.ElementTree as ET | |
| POST_URI = 'http://116.212.108.236:802/PaymentServices.asmx?op=PaymentRequestFromECom' | |
| user_id = 'ecomauser' | |
| password = 'itreus#7102' | |
| vendor_code = 'GP' | |
| phone_number = '01989782605' | |
| post_or_pre = 1 |