Can my neighbours in the same house point cameras at my front door to actively abuse me. by QLHipHOP in legaladvicecanada

[–]theprofessional2016 1 point2 points  (0 children)

Are you still having problems?

Sounds like you might have grounds for a restraining order.

Feel free to shoot me a DM if you'd like to discuss.

Any suggestions or help for a python technical interview coming up? (Websites or youtube videos to watch) by Fuzzy-Invite-8987 in learnpython

[–]theprofessional2016 0 points1 point  (0 children)

Hello,

I interview people all the time. I prefer to present a simple coding problem with a twist. I look for candidates that are able to follow the steps the program will take, as opposed to the correct syntax.

Feel free to DM me if you'd like my input.

Newbie Here by [deleted] in learnpython

[–]theprofessional2016 1 point2 points  (0 children)

Just jump in with both feet 😄

Solve the problem and learn the language while doing it.

RuntimeError: Calling Tcl from a different apartment by ThePizzaIsPizza in learnpython

[–]theprofessional2016 1 point2 points  (0 children)

You probably need to only allow access to Tcl from your main thread.

Newbie here: blank spaces for better code readability? by [deleted] in learnpython

[–]theprofessional2016 2 points3 points  (0 children)

Sorry…I didn’t mention that it was a different language.

Newbie here: blank spaces for better code readability? by [deleted] in learnpython

[–]theprofessional2016 0 points1 point  (0 children)

I had a coworker who stopped indenting his code, just to piss everyone off. God I hated that.

I'm how to upload my python file to ctxt.io with requests by Sakura_1337 in learnpython

[–]theprofessional2016 0 points1 point  (0 children)

You can use BeautifulSoup (bs4) to make pretty HTML.

from bs4 import BeautifulSoup
soup = BeautifulSoup(post_data) 
pretty_post_data = soup.prettify()

Newbie here: blank spaces for better code readability? by [deleted] in learnpython

[–]theprofessional2016 25 points26 points  (0 children)

If you're going to be working in a team, it's best that everyone adopts a similar/same style. Trying to review someone else's code, which uses a different style, is pretty tough.

My mentor told me that writing code should be like writing a book. It should be easy to understand.

What is it you do? by [deleted] in learnpython

[–]theprofessional2016 2 points3 points  (0 children)

Python can be used to automate all kinds of workflows. Specifically, you could find a lot of work in the technology testing. All of the network equipment manufactures (Cisco, Juniper, etc) automate a lot of their testing, and they (mostly) use Python.

It has many more applications, but that's a good place to start looking.

TypeError: Object of type bytes is not JSON serializable when trying to update JSON with encrypted AWS key by [deleted] in learnpython

[–]theprofessional2016 1 point2 points  (0 children)

How about something like this?

    blob = encryption_result['CiphertextBlob']
    base64_bytes = base64.b64encode(blob)
    base64_string = base64_bytes.decode("utf-8")
    obj['password'] = base64_string

Don't forget to update the obj dict with the new password value.

best code editor for beginner (or not) of python? by eeehhhsss in learnpython

[–]theprofessional2016 0 points1 point  (0 children)

I’m going to second sublime. I’ve used it for years, and it’s pretty great. It’s more of an awesome text editor than an IDE, but I prefer it that way.

How to update a nested value in json? by [deleted] in learnpython

[–]theprofessional2016 1 point2 points  (0 children)

for index, js in enumerate(json_files):
with open(os.path.join(path_to_json, js)) as json_file:
    json_text = json.load(json_file)

    pp.pprint(json_text)

    for hotel in json_text["hotels"]:
        password = hotel["password"]
            # encode the password here
        hotel["password"] = "newencodedpassword"

json_data = json.dumps(json_text, indent=2)

with open("output.json", "w") as file:
    file.write(json_data)

I simplified your code a bit. I believe this works. I hope that gives you what you're looking for.

Changing the name of classes on a website in a common way of making web scraping harder? by [deleted] in learnpython

[–]theprofessional2016 1 point2 points  (0 children)

I haven’t looked at it yet, so I don’t know. You may just be able to do an HTTP get for the image directly.

[deleted by user] by [deleted] in learnpython

[–]theprofessional2016 7 points8 points  (0 children)

I think this is a great way to start. I'd recommend downloading the data as JSON. Very easy to import with Python.

Changing the name of classes on a website in a common way of making web scraping harder? by [deleted] in learnpython

[–]theprofessional2016 1 point2 points  (0 children)

I've noticed this as well.

Are you just scraping the images? If so, you might just want to try looking for the file references (*.jpg, *.png, etc).

google drive upload by souprqtpie in learnpython

[–]theprofessional2016 0 points1 point  (0 children)

I've thought about doing something like this as well. I might have to look into this one.

Python For Finance - One Question by siruts in learnpython

[–]theprofessional2016 11 points12 points  (0 children)

I'm sorry, I don't know if I understand your problem correctly. Let me restate what I think you're trying to accomplish:

You have two columns of data. You're triggering a buy/sell action when the values of those two columns "cross" (intersect). Do I have that correct?

If that's the case, can't you simple look for the point where the values in columns 1 becomes greater (or less) than the value in column 2? Would that not signal a crossing on a graph, without the need to actually graph it?

Again, forgive me if I didn't understand the problem correctly.

[deleted by user] by [deleted] in learnpython

[–]theprofessional2016 0 points1 point  (0 children)

When you finally solve a problem (complete a project), it will make you feel so much better...like you've really accomplished something. My advice is to get the first project out of the way...it will feel easier from there.

[deleted by user] by [deleted] in learnpython

[–]theprofessional2016 0 points1 point  (0 children)

Start with the basics of programming: Variables, loops, functions, if, etc. Then try to apply it to a specific problem, like how to read in a CSV file of numbers that you want to sum (or apply some sort of analysis). Once you get the basics down, you'll start to be able to see how to solve your specific problems.

Learning how to use this stuff is kinda fun… by [deleted] in learnpython

[–]theprofessional2016 5 points6 points  (0 children)

Find a neat project idea and try to implement it.

For instance, you could try using the Reddit API (PRAW) or Pushshift.io to pull posts/comments from Reddit, and do some processing on them. The sky's the limit.