Administrator

[email protected]

Total likes received: 115 | Pubby Cash: 377


Andy Tang is the creator of Gopubby.com who has a passion for programming and everything related to technology and is skilled in many areas of coding including Python, HTML/CSS, Bootstrap, and SQL. He is experienced with many Python modules including Pygame, Flask, BeautifulSoup, and Kivy. He also has a solid knowledge of Windows, Mac, and Linux/Unix operating systems.

Articles Liked by Me: 82

Mapping IP addresses to Geographic Locations in Python

Categories: Tech | Pubby Cash Received:  10

An IP address - a list of four segments of 3 digits numbers between 0 and 255 and connected by dots can contain more information than you think. Underneath this article, you can see where this article is posted from. This gives you an example that an IP address can be transformed to the geographical location. I'm introducing one way to realize it in Python - use API from ipinfo.io. Their free version can give the geographic location, ISP provider's name, and even GPS coordinates of the location, which should be enough for most website owners. Their API include a token, which is good for querying 50,000 times a month. The following code can be used as an example. Remember to replace the ip and token with your ip and token. import requests, json link = f'https://ipinfo.io/{ip}?token={token}' r = requests.get(link) content = json.loads(r.content) print(content) ...  Read more

How to make people at a higher level access more information than ones at a lower level using Python.

Categories: Tech | Pubby Cash Received:  0

Do you know how to people at a higher level access more information than ones at a lower level using Python? Well, if you do not know how, here is a way to do it. Let's say that you want people above level 4 to access other user's locations, but not people below level 4. You can do this by making two parts. For example, one could be info and the other one could be info_m. The info means what people below level 4 see and info_m means what people above level 4 see. Then you would assign each one their value. Here is an example. info = f"{content['region']} {content['country']}" info_m = content Once you did that, you can go to your HTML. In your HTML, use an if statement and an else statement. Here is an example. if level > 4 print(info_m) else print(info) After that, save your code by pressing the Ctrl and the S key at the same time. Finally, run your code....  Read more

What is an IP address

Categories: Tech | Pubby Cash Received:  0

Do you know what an IP address is? Well, the IP address stands for internet protocol address. An IP address is 4 or 6 groups of numbers separated by a period. A group of 4 numbers is known as IPv4 and a group of 6 is known as IPv6. Each group of numbers must be between 0 and 255. For example, 123.123.123.123 is a valid one, but 321.321.321.321 is not. This is because 321 is greater than 255. You might be wondering what an IP address does. Well, it is a tool made for devices so they can connect to a computer network that uses the Internet Protocol for communication. It can also be used to track your physical location....  Read more

Methods of Converting a String of Numbers Separated by Commas to a List of Numbers in Python

Categories: Tech | Pubby Cash Received:  20

When coding in Python, free conversion of different data types is a skill that one must master. Today, let's talk about one scenario: here is a a string of numbers separated by commas: numb_str = '1,2,3,4,5' You need to convert it to a list like this: [1,2,3,4,5]. How would you do this? There are multiple ways: Method 1: numb_str = '1,2,3,4,5' numb_str_list = list(numb_str) # Destruct all elements print(numb_str_list) # Result: ['1', ',', '2', ',', '3', ',', '4', ',', '5'] numb_list = [] # Build an empty list for item in numb_str_list: # loop over the list     if item.isdigit(): # check if an item is a number         numb_list.append(int(item)) # if yes, convert it to an integer and then append to the list print(numb_list) # Result: [1, 2, 3, 4, 5] Method 2: numb_str = '1,2,3,4,5' numb_str_list = numb_str.split(',') # Extract the element from the string except the comma print(numb_str_list) # Result: ['1', '2', '3', '4', '5'] numb_list = [] # Build an empty list for item in numb_str_list: # loop over the list     numb_list.append(int(item)) # convert it to an integer and then append to the list print(numb_list) # Result: [1, 2, 3, 4, 5] Method 3: numb_str = '1,2,3,4,5' numb_str_list = numb_str.split(',') # Extract the element from the string except the comma print(numb_str_list) # Result: ['1', '2', '3', '4', '5'] numb_list = [int(item) for item in numb_str_list] # A concise way of doing method 2 print(numb_list) # Result: [1, 2, 3, 4, 5] Of the three methods, which one do you like best? ...  Read more

Strings to List in Python

Categories: Tech | Pubby Cash Received:  0

Do you know how to turn strings to lists in Python? Well, here is my way to do it. First, you need to separate each value from the comma. You can use the split method to do this. In the parentheses of the split method, put quotations and then a comma inside it. After that, you need to make it an integer. To do that, use the int method. Then, use the print method to print what you just did. You should have printed a list of values without quotations. ...  Read more

1 ... 8 9 10 ... 17

Daily Deals


MECHANICSBURG WEATHER