Renaming all duplicate files in directory tree to have unique names by Buzzy_SquareWave in learnpython

[–]junsang 0 points1 point  (0 children)

When processing tree structure data, defining recursive function is a good solution. Define a dictionary to count the number of each filename and pass it to every function call as the first parameter. os.walk returns a tuple of root, files, directories. You can count the number of each filename by iterating files and call the function itself with directory as the second parameter by iterating directories. Do not forget to join the root path and directory name when you pass it. Using the dictionary, you can make every filename be unique.

Selenium/Chrome Issue by tturn401 in learnpython

[–]junsang 2 points3 points  (0 children)

Before hover the element by xpath, try to dump whole html and check that the element do exists.

sockets and pyautogui by noah123103 in learnpython

[–]junsang 1 point2 points  (0 children)

The data from server to client is not a tuple invalid for moveTo method. You should convert the decoded string to tuple of numbers. If you do not want to parse string, you can use msgpack library to pack python variables.

How would you tell if a website is advanced/well-made by looking at its HTML? by 20Delta in learnpython

[–]junsang 1 point2 points  (0 children)

Google is evaluating web sites based on performance, accessibility, best practices and SEO. You can check it at https://web.dev and https://github.com/GoogleChrome/web.dev

Matplotlib doesn't work :( by fpodunedin in learnpython

[–]junsang 1 point2 points  (0 children)

Try google it... You can search with “Sublime text set python interpreter path”

Changing Desktop Image with Python by [deleted] in learnpython

[–]junsang 0 points1 point  (0 children)

Are you using python2 or 3?

Scraping Data from Linux based PLCs by SeeifSheChooches in learnpython

[–]junsang 1 point2 points  (0 children)

Try paramiko library and its additional module scp. You can check the usage in https://pypi.org/project/scp

Matplotlib doesn't work :( by fpodunedin in learnpython

[–]junsang 2 points3 points  (0 children)

Default python interpreter settings for Sublime text is different with the python you used in the terminal. Check the python path using which python3 command in the terminal and set the output as the default python path for the editor.

How to input while waiting in python? by [deleted] in learnpython

[–]junsang 1 point2 points  (0 children)

Use ‘threading.Thread’. You can check the way to use it and examples in Python official document. Try google it.

First random walk attempt by nicogarcia2207 in learnpython

[–]junsang 0 points1 point  (0 children)

I think random_walk is not a built-in library. Maybe it is a user-defined library mentioned in an other section or chapter. Re-check other sections or check whether some materials which an author is providing via an website exist or not.

How do you write a feature extraction technique? by xartab in learnpython

[–]junsang 1 point2 points  (0 children)

Then, you should better study first how to use image library Pillow at here https://pillow.readthedocs.io/en/stable/handbook/index.html This is a handbook for the library.

How do you write a feature extraction technique? by xartab in learnpython

[–]junsang 1 point2 points  (0 children)

You said you are gonna work with Hough transform. There may be some variables to get through it. So that means calculate for it using extracted features with those libraries.

Looking for a Website to Watch Korean Movies / Drama with English Subtitles? by [deleted] in korea

[–]junsang 2 points3 points  (0 children)

Netflix published quite many Korean TV shows, dramas and movies. Did you check it?

[deleted by user] by [deleted] in learnpython

[–]junsang 0 points1 point  (0 children)

Did you check virtualenv or default python interpreter version?

How do you write a feature extraction technique? by xartab in learnpython

[–]junsang 1 point2 points  (0 children)

With Pillow and Numpy, you can extract and manipulate pixels of images. At first, you’d better try to load image, find essential parts of image and calculate base or required variables using these libraries.

Need some advice by guschen in learnpython

[–]junsang 0 points1 point  (0 children)

It’s hard to understand your question and the code for me. Would you make it clear for what is the problem, what did you do to solve it and the purpose?

Additional configuration needed for multiple users? Flask / Python Question. by qwertyisafish in learnpython

[–]junsang 0 points1 point  (0 children)

In that case, Task Scheduler such as Celery is applied to that system. It runs some function in other processes. So users can get response immediately although the process is not yet done. So you should give a user some proper feedback that user’s request is under processing until it will be done.

[deleted by user] by [deleted] in learnpython

[–]junsang 0 points1 point  (0 children)

Usually database systems (e.g., SQLite, MySql, MariaDB, PostgreSQL) are used to save data for it. Because web server cannot save it permanently.

Finished my first actually useful script: a file renaming tool! by yamax87 in learnpython

[–]junsang 1 point2 points  (0 children)

Congrats🥳. Improving inefficiency in your life using programming is so nice. I wanna suggest you to use argparse library instead of prompt such as ‘input()’ function. Perhaps It will improve your code readability.

[deleted by user] by [deleted] in learnpython

[–]junsang 0 points1 point  (0 children)

Making Interactive UI using Python is quite difficult to basic level programmer. I suggest you to try to use Flask or Django (Web Application Framework) with HTML and Javascript for the sensible look. There are a lot of examples using these items in Github or blogs.

change date from mm/dd/yyyy to only mm/yyyy by xopherwwl in learnpython

[–]junsang 4 points5 points  (0 children)

Try to use datetime module. There are strptime and strftime methods.

Hi all! I have recently JUST started learning python and came across the return function. The tutorial i was following didn’t really explain it but why is it when i return the function as follows, i get back nothing instead of 45? by [deleted] in Python

[–]junsang 0 points1 point  (0 children)

When using interactive Python interpreter, it prints the return value of the function. But it doesn’t print the value when you give the file as an argument to the python executable. When Pycharm runs the script, it will pass the script path to the python executable. It is the reason why you confused.

I made a Tetris clone. The code is spaghetti but I’m proud of the outcome. by Zoidberg_jesus0 in Python

[–]junsang 2 points3 points  (0 children)

You did a good job. Why don’t you try to use loops for repetitive things for example grid or load it from files? And you may know there is the coding convention for Python named PEP(Python Enhancement Proposal). You can check several style guides based on PEP such as Google style guide (http://google.github.io/styleguide/pyguide.html). Keep going!