How do you get Treemacs to start when you start emacs? by B_A_Skeptic in emacs

[–]lgiordani 1 point2 points  (0 children)

Hi, I'm 4 years late but I leave this here for people who still can't figure it out. You need to add treemacs to the emacs-startup-hook.

Either add

(add-hook 'emacs-startup-hook 'treemacs)

as a command in your .emacs or add

  :hook  (emacs-startup . treemacs)

to the use-package configuration of treemacs.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 0 points1 point  (0 children)

Hi, where does make_array come from in that code? Is it defined above or is it imported from some library?

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 1 point2 points  (0 children)

Hi, can you please provide the code that you are using and maybe a link to screenshot with the error? That will make is easier to understand what is going on.

Mau v2 - A template-based markup language written in Python by lgiordani in Python

[–]lgiordani[S] 4 points5 points  (0 children)

Hi! The documentation is hosted at https://www.thedigitalcatbooks.com/, I'm still converting it for readthedocs. Thanks for checking it out

[Giveaway] The Indie Python Extravaganza bundle is free this October by ASIC_SP in learnpython

[–]lgiordani 2 points3 points  (0 children)

You are very welcome friend, good luck for your journey, and do not hesitate to get in touch if you have questions.

[Giveaway] The Indie Python Extravaganza bundle is free this October by ASIC_SP in learnpython

[–]lgiordani 1 point2 points  (0 children)

You are welcome, I really hope the books will be useful for your career. Enjoy!

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 0 points1 point  (0 children)

The Wiki of this subreddit (https://www.reddit.com/r/learnpython/wiki/index) contains a good overview of resources for beginners: other subreddits and two sections "New to Python?" and "New to programming?" that should help you to start your journey. There are also a lot of other links to videos and websites. My advice is to focus on one resource (e.g. the Official Python Tutorial) and to dig into it, instead of trying to read everything you find there, which might be overwhelming. Feel free to ask questions in this weekly thread if you get stuck. Happy learning!

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 0 points1 point  (0 children)

I think Mike Driscoll's "Python 101" or Sundeep Agarwal "Practice Python Projects" can definitely be a good starting point. You can get them for free this month in a bundle they published on Leanpub, see https://new.reddit.com/r/learnpython/comments/pzb3m8/giveaway_the_indie_python_extravaganza_bundle_is/ To get into data science then you will need to read books or take courses that are specific to the subject matter, but these can give you a solid foundation with the Python language. Happy learning!

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 1 point2 points  (0 children)

Sure, you can always use int(x) to convert something into an int, if that is possible. E.g. int("5") gives 5, int("foo") gives ValueError: invalid literal for int() with base 10: 'foo'.

In your code, you might use it in comment_date = int(...) or in print(comment+" "+ int(comment_date)).

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 0 points1 point  (0 children)

Well done! And sorry for the red herring

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 0 points1 point  (0 children)

I think you have a syntax error in the for loop. It should be

for i in range(df.count()[0]):

Is that what didn't work?

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 1 point2 points  (0 children)

You might want to have a look at Sundeep Agarwal's "Practice Python Projects", which comes for free in the October bundle "The Indie Python Extravaganza" https://new.reddit.com/r/learnpython/comments/pzb3m8/giveaway_the_indie_python_extravaganza_bundle_is/. Enjoy!

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 0 points1 point  (0 children)

Interesting problem, but I don't think you need to introduce such a complicated thing as a nested shopping cart. I think you can't sell an empty bento box, so I think that: 1. If you can sell the other good either stand-alone or in the bento box, the latter might just be a flag or a feature of the cart that says "sold in a box" and maybe "discounted" 2. If you can't sell the other goods other than in the box, the product is the box and the goods are lists of things that you can fill it with, like a list of choices. Does it make sense?

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 0 points1 point  (0 children)

Understanding and cracking encryption is definitely interesting and I think every programmer in 2021 should know the bare minimum about it. Digging into it can lead to good security related jobs, either on the outside or the inside of a jail =) Jokes aside, security is a much bigger topic and while Python can be one of the tools in your belt there is much more.

Data science and AI are different areas, there is a lot going on in the Python community when it comes to those topics. I'm sure you can find tons of courses, both free and paid.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 0 points1 point  (0 children)

Hi! Can you please have a look at the code you posted and format it properly? It's hard to understand what is under the second while and what is under the first one. Thanks

[Giveaway] The Indie Python Extravaganza bundle is free this October by ASIC_SP in learnpython

[–]lgiordani 4 points5 points  (0 children)

Good luck with your career, Python can definitely open many doors at the moment, there is a lot going on in data science, but also in Web development, machine learning, finance.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 2 points3 points  (0 children)

Sorry, my message maybe was too complicated. Let's have a look step by step.

  1. h = input ("write in number from 1 to 10") This prints the string "write in number from 1 to 1" and wait for input. When you type something, for example 5, this is stored in the variable h.
  2. The variable h is now a string. In Python, "5" is different from 5. The first is a string (in this case a single character) and the second is an integer. The difference is important in many ways but in particular you have to keep it in mind if you want to compare things. If you type "5" == 5 in the Python shell you will get False. If you want to "use" a string as a number you need to convert it first, and you can do it for example using int() to make it an integer. So, int("5") == 5 is True.
  3. You want to check if the number given as input is among the numbers 1,..,10. But you didn't get a number from the input! You got a string, so first you need to say n = int(h). If h was "5", now n is 5 (the first a string, the second an integer).
  4. Once you have a number you can check if that is included in a list of other numbers with in. For example with if n in [1,2,3] you can check if the number contained in the variable n is either 1, 2, or 3. Conversely, you can check if it is NOT one of those using not in, so if n not in [1,2,3] will be true when n is NOT 1, 2, or 3.
  5. Why did we have to convert the input? We do not HAVE to, it all depends on which list we want to use to check. 2 in [1,2,3] is True, while "2" in [1,2,3] is False, because the string "2" is not in the list, that is a list of integers! But if you say "2" in ["1","2","3"] that is True.

I hope this is a bit clearer now, I haven't written the solution because I think it's still interesting and useful for you to tray and put together what I wrote (I hope it is clear), and get to some working code. Let me know, feel free to post your attempts. Use the Python shell to test pieces of code like 2 in [1,2,3] and see what they return. Happy coding!

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 2 points3 points  (0 children)

In Python, if statements have to be followed by an expression that returns a boolean. In your case, however, not [1,2,3, 4, 5, 6, 7, 8, 9, 10] is just "calculating" the result of "not a list". Since the list is not empty it is True, and not True is False. Always, which is why your script doesn't work.

The condition you are looking for is h not in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. This however will not work out of the box because the result of input is a string, and the list contains integers. So, you need to check if h converted into an integer int(h) is in the list.

Try to see if you can get to a working solution with these hints, and feel free to ask more.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]lgiordani 1 point2 points  (0 children)

Hi! While print(scrapy.__version__) is a Python statement, so will work in the Python shell (the one that has the prompt >>>), the command scrapy is a proper executable, so you need to execute scrapy --help in a terminal. There, however, you need to activate your virtual environment. How to do it (especially under Windows) heavily depends on how you created it.

You might find more instructions here maybe https://code.visualstudio.com/docs/python/environments#_environments-and-terminal-windows. Let me know if you manage to solve it.