Python is a widely used general-purpose, high-level programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in other languages. Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive set of standard libraries, including NumPy, SciPy, Django, PyQuery, and PyLibrary.

Share tech news, updates, or what's on your mind.

Sign up to Post

All the best modern games are pseudo 3D, like League of legends and Starcraft 2.

Is it pseudo 3d? - It is 2D images used smartly at correct locations?

How do Starcraft 2 and League of Legends achieve their 3D feel?

Would Python be able to do decent game-play FPS & updates in time with my client networking class?
MIT and everyone is teaching CS100 in Python, and I've seen some promising 2D demos.
Receive 1:1 tech help
LVL 12
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Considering the RTS project many of you helped me complete,

Java had no problem being an abstract base class client engine,
and the JFrame was smooth.
Will a Python GUI do adequately with a client engine abc ? The abstract method can update a GUI's objects. Will I need to do double buffering on a GUI?
Could I make a Python effort approach  League of Legends quality? I'm keeping the server in Java, but the client abc will be ported to Python.
Good day
I have just started studying Python Version 3.6. 64 bit on Windows 10 Professional. How do I download Qt 5 without showing any errors when I go to cmd prompt to change the .ui file to a .py file after creating the the program in Qt Designer. i have gone to YouTube and tried all the ways that they show you to uninstall and then reinstall there way. I still sit with the same error. 'pyuic5' is not recognized as an internal or external command, operable program or batch file.'
File: c:\Qt 5
File: c:\Python36
The Qt download is also 64 bit.
If someone can please give me a step by step guide how to rectify this problem. I have been battling with this for 3 days.
I am about to pull my hair out.
Thanking you
Looking for a way to add more than one JSON file to the script, below to produce a single CSV, but with multiple rows.  Each row should include the same number of fields and attributes, but be tied to a single JSON (ROW 1 = JSON 1, ROW 2 = JSON 2, etc.).  The following produces a CSV with one row of data from a single JSON.

import pandas as pd
df = pd.read_json("pywu.cache.json")
df = df.loc[["station_id", "observation_time", "weather", "temperature_string", "display_location"],"current_observation"].T
df = df.append(pd.Series([df["display_location"]["latitude"], df["display_location"]["longitude"]], index=["latitude", "longitude"]))
df = df.drop("display_location")
print(df['latitude'], df['longitude'])
df = pd.to_numeric(df, errors="ignore")
pd.DataFrame(df).T.to_csv("CurrentObs.csv", index=False, header=False, sep=",")

Open in new window

I don't know anything yet about reading/writing/manipulating mp3 and mp4 files, but I'm trying to learn.  I need to write a program that reads in mp3 and mp4 files, silences some of the audio portions, and rewrites out the final file.

For an mp3 file, I can use ffmpeg to convert it to a wav file and process and write it back out as an mp3.  I don't think a wav has any messy internals.

For mp4, what with variable bit rates and metadata and such, I don't know how to approach it.  I need to read the mp4 file, modify the audio portion only while staying in sync with the video, and write out the mp4 file again.

My preferred langauge is Python if at all possible, but I'll use C# if I have to, and Java as a last resort.

How can I do this?
# Return the reversal of an integer, e.g. reverse(456) returns  # 654
       def reverse(number):
       # Return true if number is a palindrome
       def isPalindrome(number):
Use the reverse function to implement isPalindrome . A number is a palindrome if its reversal is the same as itself. Write a test program that prompts the user to enter an integer and reports whether the integer is a palindrome.
from selenium import webdriver
text=str('good day ')

This works fine , but when i use xpath

I am getting Error . Kindly anyone help me with this
I have built a basic tool using Python to run powershell commands. I would like to create some .bat or something that can open said Python script within an Admin Powershell terminal. Some of the commands require Admin privileges, and I can't change to a different drive in admin mode, so I want to store the "startup" script within an all encompassing folder (holding the python script and various powershell scripts that I wasn't able to translate into Python yet), so this would be a portable tool. Does anyone have a suggestion on how to accomplish this? I was able to write a simple script to open an admin powershell terminal, but it only opens a blank terminal separately, and the python script opens within the first terminal that opens, which doesn't have admin rights.

I have this error occurred when installing Python2.7 on AIX 6 OS :

 error: command '/opt/freeware/lib/python2.7/config/ld_so_aix' failed with exit status 8

Can I install separately ld_so_aix ? How ? Where can I get the library ?

Thanks for your reply
I am trying to create neural network for help find the best solution for house heating.

I have 2 problem in my code:

    The program returns "[1.]" in solution, or I want that my solution is between 8-1

    I do not know if it's possible, but I want to apply the neural network to samples which are missing some values, for example I want to add this :

    input : [[0, 2], [7, missing]]

    output : [8, 11]

Can a neural network algorithm support incomplete data?

from numpy import exp, array, random, dot

class NeuralNetwork():
    def __init__(self):
        self.synaptic_weights = random.uniform(0,11,(3, 1))

    def __sigmoid(self, x):
        return 1 / (1 + exp(-x))

    def __sigmoid_derivative(self, x):
        return x * (1 - x)

    def train(self, training_set_inputs, training_set_outputs, number_of_training_iterations):
        for iteration in range(number_of_training_iterations):
            output = self.think(training_set_inputs)
            error = training_set_outputs - output
            adjustment = dot(training_set_inputs.T, error * self.__sigmoid_derivative(output))

            self.synaptic_weights += adjustment

    def think(self, inputs):
        return self.__sigmoid(dot(inputs, self.synaptic_weights))

if __name__ == "__main__":
    neural_network = NeuralNetwork()

    print("Random starting synaptic weights: ")


Open in new window

Free Tool: SSL Checker
LVL 12
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I'd like to write a Lambda function that fetches a (1) CloudWatch Metric (that is already being monitored at every 5 minutes), (2) divides that value by 300 seconds and (3) pushes to CloudWatch as a Custom Metric.

The CloudWatch metrics already being monitored are "Volume Read Ops" and "Volume Write Ops" on a could different active EBS volumes.

I have no every on using Java or Python for this.

Thanks for your help or pointing me in the right direction.
Hi, in Python
It is not totally obvious, to me, how my abstract bass class for my RTS client should look... Threading included
In Java, it is as below, what would it look like in Python? processNewGameState() is the abstract method
Thread - Do I make my own method called run and call it from the __main__ region?

import java.util.Random;

public abstract class GSclient extends Thread{

int clientCount=0;
	int clientCountExpected;	
	public static int SERVER_PORT_BASE=1027;
	public static byte MSG_HELO=1;
	public static byte MSG_START=5;
	public static byte IN_GAME_MSG=4;
	public static byte GAME_MSG_MOVE=8;
	public static byte GAME_MSG_CREATE=16;
	public static int MSG_SIZE = 4098;

	public abstract void processNewGameState();
	public GSclient(int cliNum, InetAddress serveraddress) {
		serverAddress= serveraddress;

Open in new window

My run() Thread method will receive incoming game-state messages and call the process method on each.
I assume the TCP and UDP receiving and analyzing code won't be too out-there
I can do the client networking, no problem.


If I put my keyboard listening in pygame in my drawing/game loop, it obviously won't be checked constantly.
I must obviously have a Thread listening for keyboard input, mouse movement to play my game and update internal game variables.

Is this just a new class I must make with two methods each to listen to pygame keyboard/mouse activity. Case closed?

An error occurred (ValidationException) when calling the PutItem operation: One or more parameter values were invalid: Type mismatch for key Xyz expected: S actual: M

Sometimes it throws **expected: S actual:** SS

I am using boto3 for this. I am trying to put an item in DynamoDB table. Below is my python snippet:  

    from boto3.dynamodb.conditions import Key, Attr
    dynamodb = boto3.resource('dynamodb',region_name='us-west-2')
    table = dynamodb.Table('Xyz-Account')
            'Xyz': {'S': xyz_num},

Open in new window

xyz_num variable is string type. I cross checked that.And I have checked the table field in the dynamodb, it is a string type field and not number or any other type. Where is the mismatch occurring here ? And by the way, the function ran coolly a while ago, but then some black magic happened and this error came up. I've been trying to resolve this for 3 hours. Can anyone help ? Thanks in advance.
I am using following function to recursively search values in dictionary based on key.

I need assistance to change this and would like to pass a list of keys and search that recursively...

def get_recursively(search_dict, field):
    """Takes a dict with nested lists and dicts,
    and searches all dicts for a key of the field
    provided. This function recursively searches a dictionary 
    containing nested dictionaries and lists. It builds a list called 
    fields_found, which contains the value for every time the field is found.
    The 'field' is the key in the dictionary and its nested 
    lists and dictionaries.
    fields_found = []

    for key, value in search_dict.items():

        if key == field:

        elif isinstance(value, dict):
            results = get_recursively(value, field)
            for result in results:

        elif isinstance(value, list):
            for item in value:
                if isinstance(item, dict):
                    more_results = get_recursively(item, field)
                    for another_result in more_results:

    return fields_found

Open in new window

Current usage


Open in new window

Required usage:


Open in new window

I am using python mailchimp API
I would like to fetch data from mysql database and create a list in mail chimp.

If anybody can share sample code it will highly appreciated.

I have a text file which has multiple json rows in it.

What I need to do is the following:-

1. Read thru the file
2. Select only certain elements not all, remap to a new name for example AuthenticationId could be AuthId
3. Ingest in to MongoDB as JSON

How can this be achieved in Python?

{"AuthenticationId":"997","CommandLine":"C:\\Windows\\system32\\wbem\\wmiprvse.exe -secured -Embedding","ConfigBuild":"1007.3.0005907.1","ConfigStateHash":"3163607488","EffectiveTransmissionClass":"3","Entitlements":"15","ImageFileName":"\\Device\\HarddiskVolume3\\Windows\\System32\\wbem\\WmiPrvSE.exe","ImageSubsystem":"2","IntegrityLevel":"16384","MD5HashData":"1df2fc82b861bc9612657d1661e9ae33","ParentAuthenticationId":"997","ParentProcessId":"1627804482161","ProcessCreateFlags":"16","ProcessEndTime":"","ProcessParameterFlags":"24577","ProcessStartTime":"1512962460","ProcessSxsFlags":"64","RawProcessId":"9276","SHA1HashData":"1aa3fda50123dd14a055b4d6601beedead69fe11","SHA256HashData":"835f2a94e47830b06654e484bf7a1cc0b9882f579716dca198e32d22218a07e5","SourceProcessId":"1627804482161","SourceThreadId":"39913451443946","TargetProcessId":"1756187997441","TokenType":"2","UserSid":"S-1-5-19","aid":"2bc82f8878df4b9f7712273e755a93be","aip":"","cid":"99cdff8f89af458d858c3d6b3e312e11","event_platform":"Win","event_simpleName":"ProcessRollup2","id":"4ff73eae-de22-11e7-a0dd-06e913674db2","name":"ProcessRollup2V6","timestamp":"1512962460994"}

Open in new window

Open in new window

Visual Studio Pop ups are really annoying.   People are writing these add in's for visual studio and forgetting to deal with the intellisense pop ups.  The problem I have is the python add in / support...  Apparently there is a JSON attribute that can help with this  {"editor.parameterHints": false}  but I don't know where to put this parameter and I don't know much about visual studio add in development.

Can you tell 1) How to turn off pop-up's specifically for the python editor?  or 2) What file can i put this attribute in to turn this off?
The pop ups pop right in front of code that I have need to edit... It's crazy

---------------Below is a copy from my about box to show python editor version.---------------

Microsoft Visual Studio Community 2017
Version 15.2 (26430.12) Release
Microsoft .NET Framework
Version 4.6.01055

Installed Version: Community

Visual Basic 2017   00369-60000-00001-AA166
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA166
Microsoft Visual C# 2017

Visual C++ 2017   00369-60000-00001-AA166
Microsoft Visual C++ 2017

Application Insights Tools for Visual Studio Package   8.6.00404.2
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30503.0
ASP.NET and Web Tools 2017

Azure App Service Tools v3.0.0   15.0.30209.0
Azure App Service Tools v3.0.0

Common Azure Tools   1.9
Provides common services for use by Azure Mobile Services …

On our last RTS we did, Java, the networking worked perfectly and the GUI worked seamlessly in time w it.
Will a Python GUI handle  a game window adequately? - as well as possible
What about with TCP and datagrams underneath it all?
Another question already suggested I keep the server in Java, for now.

[Webinar] Improve your customer journey
LVL 12
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Hello Experts

what are the pre requisites to learn python, Do we need to have any programming knowledge ? is it easy for the new learners who are trying to learn ?..

I finally got Python images to be plopped on the screen, just blitting, a lonely mutalisk, but not flapping.
To make my mutalisk flap its wings in python, or any of my many animated GIF's, for that matter, must I blit them frame by frame? I was surprised it wasn't automatic flapping, like in other situations.

Here is the blit code that finally worked. . .

Hi there!

I have an issue preparing an installation of Python/IDLE in one of my client's team computers. Basically, I prepared a couple of scrappers using Python and Selenium. The packages being used on my scripts are selenium, openpyxl, and python-docx.
However, I can't even get to installing the packages on that machine, because one I execute the Python installer from the website (3.6.x), the insteller won't. I tried using admin rights, disabling antivirus, I checked the correct processor architecture, and I still can't get to run the installer on that particular machine. In other team members I was able to installe in their machines. I have run out of ideas to trouble shoot this. Could you please point me to things that I can try out to run the installer Python/IDLE installer?

Thank you so much!
Any help is greatly appreciate it.
I would like to write a custom check writing software for this dot-matrix printer.
Preferably in python. Any recommendations on how to go about this? What is the best language etc...
I think I would prefer a Linux environment but I am open to c# .net windows as well.
Could anyone please help me in getting a way to get the source code from Environment or SB Console or Weblogic.

I created the python script whick exports the JAR, but I need the source code. Because if I unjar the jar, I do not get the exact source code, as file names are shorten and some code is added by itself in wsdls, xqueries etc. I don't want this matadata. I just need the source code.

If I import this jar in Jdeveloper. It erases all the matadata. I need that source code. I have no idea how Jdeveloper do this.

Here's my wlst Python/Jython Script:

from import FileInputStream
    from import FileOutputStream
    from java.util import ArrayList
    from java.util import Collections
    from import EnvValueTypes
    from com.bea.wli.config.env import EnvValueQuery;
    from com.bea.wli.config import Ref
    from com.bea.wli.config.customization import Customization
    from com.bea.wli.config.customization import FindAndReplaceCustomization
  import sys

# Utility function to load properties from a config file
def exportAll(exportConfigFile):

def exportAll(exportConfigFile):
            print "Loading export config from :", exportConfigFile
            exportConfigProp = loadProps(exportConfigFile)
How can I use python in order to get the  router running-config file through ftp protocol?
I now that in the router you only need to use this command copy running-config ftp, but I want to get the file from the host.


Python is a widely used general-purpose, high-level programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in other languages. Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive set of standard libraries, including NumPy, SciPy, Django, PyQuery, and PyLibrary.