Posts under tag: "Looping"

Joining each list values with zip

By: summonagus ● at Aug. 25, 2017, 8:10 a.m. ● Posted under: #Tricks, #Looping, #Beginner

Here we use zip to iterate over the two containers in parallel.>>> countries = ['Indonesia', 'India', 'Denmark', 'Singapore'] # 4 length >>> statements = ['is Great', 'is WOW', 'is Good', 'is Awesome'] # 4 length >>> >>> for country, statement in zip(countries, statements): ... print(country, statement) ... Indonesia is Great ...

Read More →

Django: Remove Duplicates Filter for Related Posts

By: summonagus ● at Oct. 2, 2016, 3:28 p.m. ● Posted under: #Templates, #Django, #Looping

Django: Remove Duplicates Filter for Related Posts. 1. In yourapp/models.py class Post(models.Model): title = models.CharField(max_length=200) slug = models.SlugField(max_length=200, unique=True) tags = models.ManyToManyField('Tag') 2. In yourapp/views.py class DetailPostView(generic.DetailView): model = Post template_name = 'blog/blog_detail.html' def get_context_data(self, **kwargs): context_data = super(DetailPostView, self).get_context_data(**kwargs) related_posts = Post.objects.filter( tags__in=list(self.object.tags.all()) ).exclude(id=self.object.id).distinct() context_data['related_posts'] = related_posts[:5] # limit ...

Read More →

Untranslate Tools for Cryptography

By: summonagus ● at Oct. 2, 2016, 8:13 a.m. ● Posted under: #Tricks, #Problem, #Security, #Looping

Untranslate Tools for Cryptography, This made for string chars that was translated with string.translate from python modules. For my stack, i think why me not build a program un-translate for it?  1. Stack Problem >>> import string >>> make_trans = string.maketrans('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 'CDEFGHIJKLMNOPQRSTUVWXYZABcdefghijklmnopqrstuvwxyzab') >>> trans = string.translate("Summon Agus", make_trans) >>> trans 'Uwooqp Ciwu' ...

Read More →

Update Implementation Bot log IRC with Python

By: summonagus ● at Oct. 2, 2016, 8:13 a.m. ● Posted under: #Project, #Looping, #Directory

Hello brother, this posts just updating from last tutorial Implementation Bot log IRC with Python, have a problem. The problem is "Just One" log that was created by bot log irc, for example like this: 2015-10-15.log, but just 1 file log. Because we need thats logs will created new file every day with ...

Read More →

Implementation Bot log IRC with Python

By: summonagus ● at Oct. 2, 2016, 8:13 a.m. ● Posted under: #Project, #Looping, #Directory

Implementation Bot log IRC with Python. Assalamu'alaikum. this night i wanna show you how to make a bot log for IRC with python. However, this usefull to implement in server. Some time ago, we find tutorial how to make a simple python IRC client at there. and that script like ...

Read More →

Simple Python search engine Google

By: summonagus ● at Oct. 2, 2016, 8:13 a.m. ● Posted under: #Grabber, #Internet, #Looping

Simple Python search engine Google. Bismillahirrahmanirrahim, malam hari ini kita akan sharing sedikit script simple search engine google dengan memanfaatkan module mechanize dan BeautifulSoup di python. Adapun yang dihasilkanpun juga tidak terlalu kompleks, yaitu hanya link dan title saja, di inisialisasi pada page one saja, yakni tidak termasuk ke page ...

Read More →

Count sum of numbers in a list

By: summonagus ● at Oct. 2, 2016, 8:13 a.m. ● Posted under: #Looping, #Beginner

Count sum of numbers in a list. Hello there, this afternoon i wanna show you how to count sum of numbers in a list. There basicly to add it. In this script, i have some numbers like a money, and adding it to big string """...""". however, making a split() ...

Read More →

Making simple Url Crawler using BeautifulSoup

By: summonagus ● at Oct. 2, 2016, 8:13 a.m. ● Posted under: #Grabber, #Internet, #Looping, #Beginner

Making simple Url Crawler using BeautifulSoup, Crawl adalah teknik yang biasa digunakan untuk mengambil sesuatu dalam website, dan dalam hal ini yang paling banyak digunakan adalah crawl link. Lalu bagaimana dengan python? apakah python sendiri juga bisa digunakan untuk teknik crawling? Jawabannya adalah sangat bisa, beberapa tools pengembangan dari python ...

Read More →

Beberapa Methode Sorting dalam Python

By: summonagus ● at Oct. 2, 2016, 8:13 a.m. ● Posted under: #Looping, #Beginner

Beberapa Methode Sorting dalam Python, Ada beberapa Metode Sorting dalam Python yang dapat kita gunakan, biasanya methode ini digunakan untuk mencari suatu data tertentu dengan menggunakan methode sorting (pengurutan), diantaranya yang paling popular adalah Bubble Sort, Quick Search, dan lain-lain. Dalam artikel kali ini kita akan share setidaknya ada 6 ...

Read More →

Project Python Google Translate

By: summonagus ● at Oct. 2, 2016, 8:13 a.m. ● Posted under: #Grabber, #Project, #Internet, #Looping

Project Python Google Translate – Program ini merupakan program Translate Bahasa yang memanfaatkan Layanan Google Translate yang diambil fungsi translatenya kemudian di terapkan pada Python Programming. Program ini ada 2 file berupa: 1. Translate.py ( merupakan programnya ) 2. id_country.txt ( merupakan database ID Negara dan Nama Negara ) /******************************* Credit By ...

Read More →