Skip to content

Instantly share code, notes, and snippets.

@nalakawula
Created September 14, 2016 07:58
Show Gist options
  • Save nalakawula/4de962de293de37f0aad103090a919ba to your computer and use it in GitHub Desktop.
Save nalakawula/4de962de293de37f0aad103090a919ba to your computer and use it in GitHub Desktop.
Kode untuk split string setiap x karakter di python
var_1 = "saya sedang belajar untuk menjadi guru profesional"
def split_string(string, length):
return (string[0+i:length+i] for i in range(0, len(string), length))
def buat_list(data, z):
return list(split_string(data, z))
hasil = buat_list(var_1, 16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment