Skip to content

Instantly share code, notes, and snippets.

@mzaini30
Created March 4, 2017 02:43
Show Gist options
  • Save mzaini30/24a6947bbad6642151ec3061957e52ff to your computer and use it in GitHub Desktop.
Save mzaini30/24a6947bbad6642151ec3061957e52ff to your computer and use it in GitHub Desktop.
Konversi tabel ke list
import re
lokasi = "/sdcard/python/tabel/"
data = open(lokasi+"data.txt").read().splitlines()
nama=[]
jabatan=[]
usia=[]
print data
print
for n, x in enumerate(data):
data[n] = data[n].split("\t")
nama.append(data[n][0])
jabatan.append(data[n][1])
usia.append(data[n][2])
print data
print
print nama
print
print jabatan
print
print usia
nama jabatan usia
zaini cto 25
ati user experience 26
rahman designer 21
andre bussiness strategies 23
rey ceo 29
d/0/python/tabel/.last_tmp.py" && exit <
['nama\tjabatan\tusia', 'zaini\tcto\t25', 'ati\tuser experience\t26', 'rahman\tdesigner\t21', 'andre\tbussiness strategies\t23', 'rey\tceo\t29']
[['nama', 'jabatan', 'usia'], ['zaini', 'cto', '25'], ['ati', 'user experience', '26'], ['rahman', 'designer', '21'], ['andre', 'bussiness strategies', '23'], ['rey', 'ceo', '29']]
['nama', 'zaini', 'ati', 'rahman', 'andre', 'rey']
['jabatan', 'cto', 'user experience', 'designer', 'bussiness strategies', 'ceo']
['usia', '25', '26', '21', '23', '29']
#[QPython] Press enter to exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment