|
Programming › Re: A Thread For Tutorial On Python Programming by nappy760(m): 1:30pm On Aug 29, 2019 |
cochtrane: Wrote a script to get the respective posts in this thread and their corresponding number of likes.
import requests from bs4 import BeautifulSoup from pprint import pprint as pprint
link = 'https://www.nairaland.com/4945611/thread-tutorial-python-programming/' posts, likes, allposts, allids = [], [], [], []
def getresponse(url): response = requests.get(url) html = response.content soup = BeautifulSoup(html, 'html.parser') return soup
def findthreadlength(url): div = getresponse(url).find("span", class_=" small" ).previous_sibling for i in range(3): div = div.previous_sibling length = div.text.split(" (" )[-1].rsplit(" )" )[0] return int(length)
for i in range(findthreadlength(link)): table = getresponse(link + str(i)).findAll('a', attrs={'class': 'user'}) posts = [item.previous_sibling.previous_sibling['href'] for item in table] allposts += posts
ids = [post.split('#')[-1] for post in posts] allids += ids
for idx in ids: like = getresponse(link + str(i)).find('b', attrs={'id': 'lpt' + str(idx)}) if like is None: like = '0 Like' likes.append(like) else: likes.append(like.text)
alllikes, fullposts = [], []
for like in likes: if like == ' ': like = '0 Like' alllikes.append(like) continue alllikes.append(like.rstrip())
fullposts = ['https://www.nairaland.com' + str(post) for post in allposts]
postdict = {} for post, like in zip(fullposts, alllikes): postdict[post] = like
pprint(postdict)
First few results below: Can you explain the program bit by bit |
|
Programming › Re: If You've Always Wanted To Learn Programming But Failed, Be Here!!! by nappy760(m): 8:14pm On Aug 26, 2019 |
|
Programming › Re: A Thread For Tutorial On Python Programming by nappy760(m): 7:53pm On Aug 26, 2019 |
Damoxy: Do you do any Serious Thing with C# and ML(Python Libraries)? Still on the basics , c# is super for web apps especially when you are familiar with OOP concept . I once attended a softdev training on C# dotnet mvc and how to build web apps using visual studio |
Programming › Re: A Thread For Tutorial On Python Programming by nappy760(m): 8:05am On Aug 26, 2019 |
pgbamane: Hey Guys, Do you know what are the different Python implementations available for us?  Those are CPython, Jython, Pypy, etc. Follow the article on Different Flavors of Python(https://www.codebread.co.in/2019/07/flavors-of-python.html) to know in details. We go dey alright las las, I am trying to joggle c#, js, python, AI&ML and now I am hearing we have different flavors of python  ...it is well |
Programming › Re: A Thread For Tutorial On Python Programming by nappy760(m): 6:57pm On Aug 25, 2019 |
|
Gaming › Re: PS4 Games Exchange by nappy760(m): 6:53pm On Aug 25, 2019 |
tobianthony: I hope you are talking about UFC 3 . And yes there are couple of us that play it online. you Yea UFC 3...I also play it but offline  |
Crime › Re: Is This "Juju," Tricks Or Black Magic? Can Someone Explain What Happened? by nappy760(m): 6:40pm On Aug 25, 2019 |
Mynd44: He switched the pack with the drinks with the empty one and asked them to put the pure water on it to give them the impression that their goods were still safe.
There is a big chance he was not alone as while they were bringing the pure water, his accomplice(s) might have made the switch. you Very possible |
Crime › Re: Is This "Juju," Tricks Or Black Magic? Can Someone Explain What Happened? by nappy760(m): 6:38pm On Aug 25, 2019 |
|
Romance › Re: How Can I Reduce The Love I Have For This Lady? by nappy760(m): 12:40pm On Aug 25, 2019 |
|
Gaming › Re: PS4 Games Exchange by nappy760(m): 12:18pm On Aug 25, 2019 |
So far so good I have not seen anyone mention UFC....  . The technicality is madt |
Romance › Re: 12 Crazy Amazing Facts About The Clitoris by nappy760(m): 11:42am On Aug 25, 2019 |
Omaricha002: call your girlfriend, open her legs wide open and see her clitoris Never mind, I think I can recollect seeing it  |
Romance › Re: 12 Crazy Amazing Facts About The Clitoris by nappy760(m): 11:42am On Aug 25, 2019 |
okoroemeka: I have seen lots of clits in m y lifetime but there's one that always stand out,in an average ordinary girl I encountered the most fantastic female organ I have ever seen,the clits have so much nerve endings that it has a mind of it's own and behaves like a living organism,going up and down,left and right at the slightest tickle with the tounge,the surrounding vulva also swells like a Michelin man and will keep puffing to extreme size,the clits can rise to the size of an adult thumb and subsise with the command of an expert tongue,in fact the experience left me dumbfolded because at a point she asked me to stuff her mouth to close the screams that is coming,the only drawback is that I met her in the village during festive period,but I always have an excuse to go to the village every now and then to worship the damn pussy.  |
Romance › Re: 12 Crazy Amazing Facts About The Clitoris by nappy760(m): 11:40am On Aug 25, 2019 |
Omaricha002: call your girlfriend, open her legs wide open and see her clitoris  and for those who don't have a girl friend nko? |
Romance › Re: 12 Crazy Amazing Facts About The Clitoris by nappy760(m): 9:35pm On Aug 24, 2019 |
Where exactly is the external part of the clitoris located |
Properties › Re: Self Con Or Room& Parlor Needed- Ibadan by nappy760(m): 7:21am On Aug 24, 2019 |
Yewandequeen: Yea true, Oluyole, Jericho, akala axis got good light Noted....I will add.this to my list Thank you |
Properties › Re: Self Con Or Room& Parlor Needed- Ibadan by nappy760(m): 10:07pm On Aug 23, 2019 |
Yewandequeen: . Ehya,i hope so. I have gotten a place over a month now that I moved, not far from My former place but trekkable to Mobil 10mins walk (it's main Oluyole). The light is 24/7 superb than the former place I was in Oluyole. I used to think my former place had the best light until my new place. Rent is 180k total 234k - it's a room and mini parlor The price...charges is 30% of the rent ....am assuming it has toilet, bathroom and kitchen in it |
Properties › Re: Self Con Or Room& Parlor Needed- Ibadan by nappy760(m): 10:01pm On Aug 23, 2019 |
Yewandequeen: . Ehya,i hope so. I have gotten a place over a month now that I moved, not far from My former place but trekkable to Mobil 10mins walk (it's main Oluyole). The light is 24/7 superb than the former place I was in Oluyole. I used to think my former place had the best light until my new place. Rent is 180k total 234k - it's a room and mini parlor Oh wow, that's great  , electricity is one of the most essential properties I'd consider before getting a place. I am somewhere after New garage were the electricity is nothing to write home aboit  , Hopefully when I am settled I would resume my search and oluyole would be on top of my list  |
Properties › Re: Self Con Or Room& Parlor Needed- Ibadan by nappy760(m): 6:48pm On Aug 23, 2019 |
Yewandequeen: pardon Lol  .....hello yewande,it's been awhile ,I have put my search on hold for the last 2months due to some issues beyond my control; hopefully I'll continue soon. Are you still on yours? |
Programming › Re: Coding Advice by nappy760(m): 2:49pm On Aug 22, 2019 |
JeffreyLiaison: My first was C++ then VB.NET then Java but it has been a long time when I was 13 since I used c++ and vb.net ;Dlol.....I totally forgot about fortran and c++ I did in school but I don't count them as programming experience  |
Programming › Re: Coding Advice by nappy760(m): 2:05pm On Aug 22, 2019 |
JeffreyLiaison: Video 3.02gb
The guy is the best web dev teacher That's a lot of data...... I would have delved into java but my first programming language was c#.I haven't learnt it well enough though I still intend to. Once I know it, any other program would be easy. |
Programming › Re: Coding Advice by nappy760(m): 9:17am On Aug 22, 2019 |
JeffreyLiaison: Javascript has syntax close to Java. I am planning to download Brad Traversy's Javascript course Pdf or video? |
Programming › Re: Coding Advice by nappy760(m): 8:51am On Aug 22, 2019 |
Understanding the syntax and concepts of any programming language requires continuous re-reading, I am presently trying to grasp by head around JavaScript |
Programming › Re: A Thread For Tutorial On Python Programming by nappy760(m): 9:52pm On Aug 21, 2019 |
cochtrane: I wrote a script to check the posters on this thread and their respective number of posts.
import requests from bs4 import BeautifulSoup from plotly.graph_objects import Bar, Layout, Figure
def gethtmlcontent(url): response = requests.get(url, headers={'User-Agent': 'Mozilla/5.0'}) html = response.content soup = BeautifulSoup(html) return soup
users = [] for i in range(10): url = 'https://www.nairaland.com/4945611/thread-tutorial-python-programming/' + str(i) print(f"Downloading: {url}" ) table = gethtmlcontent(url).find('table', attrs={'summary': 'posts'}) for row in table.findAll('tr'): for user in row.findAll('a', attrs={'class': 'user'}): users.append(user.text)
userdict = {} for user in users: if user in userdict: userdict[user] += 1 else: userdict[user] = 1
y_values = list(userdict.keys()) x_values = list(userdict.values()) data = [Bar(x=x_values, y=y_values, orientation='h')]
x_axis_config = {'title': 'POST FREQUENCY', 'dtick': 1} y_axis_config = {'title': 'USERS', 'dtick': 1, 'tickmode': 'linear'} my_layout = Layout(title='Post Frequency per User on Thread', xaxis=x_axis_config, yaxis=y_axis_config, bargap=0.5) fig = Figure({'data': data, 'layout': my_layout}) fig.update_traces(marker_color='rgb(158,202,225)', marker_line_color='rgb(8,48,107)', marker_line_width=1.5, opacity=0.6) fig.update_layout(autosize=False, width=800, height=2000) fig.show(renderer='browser') you Super cool |
Programming › Re: A Thread For Tutorial On Python Programming by nappy760(m): 9:50pm On Aug 21, 2019 |
Wow |
Programming › Re: Coding Advice by nappy760(m): 8:27pm On Aug 21, 2019 |
JeffreyLiaison: I built a lot of stuffs like the turtle language simulator, a 2d running game(android), tic-tac-toe that uses server (every programmer that has learnt a language should have done this) but all these where in my 500gb hard-disk which just spoilt recently and now I am managing my 80gb but I am planning on doing them back You need to always upload your stuff to github. Your github link will speak for you |
Family › Re: I'm Worried About My Son's Behaviour. Is He Normal? by nappy760(m): 6:06am On Aug 21, 2019 |
Are you a single mum?....it sounds like his act of rebellion is due to such but the behaviours you have mentioned seem to be that of a genius.....
He seems to excel at what he considers important and regard every other thing as unimportant |
TV/Movies › Re: BBNaija 2019 Live Updates (Big Brother Naija 2019 Thread) by nappy760(m): 8:23pm On Aug 19, 2019 |
sunnymix: can i gt a pic. She hardly wears one  She must have forgotten her the bag containing her bras at home |
TV/Movies › Re: BBNaija 2019 Live Updates (Big Brother Naija 2019 Thread) by nappy760(m): 8:19pm On Aug 19, 2019 |
hazzard: Lol..you dey mind dem..I'm sure most of them here ranting didn't even watch the video..probably they got to know about it from twitter...anyway weda dem hate am from now till the 99th day doesn't change the fact that her fans would keep her in that house till she wins the 60M. What y'all fail to realise is the more people are evicted , the more fans are available to vote for her opponents  God forbid I waste a dime of my hard earned money to vote for her..  |
TV/Movies › Re: BBNaija 2019 Live Updates (Big Brother Naija 2019 Thread) by nappy760(m): 8:10pm On Aug 19, 2019 |
|
TV/Movies › Re: BBNaija 2019 Live Updates (Big Brother Naija 2019 Thread) by nappy760(m): 5:27pm On Aug 18, 2019 |
|