About 50 results
Open links in new tab
  1. What does [:-1] mean/do in python? - Stack Overflow

    Mar 20, 2013 · Working on a python assignment and was curious as to what [:-1] means in the context of the following code: instructions = f.readline()[:-1] Have searched on here on S.O. and on Google …

  2. What does the "yield" keyword do in Python? - Stack Overflow

    Oct 24, 2008 · Then each time you extract an object from the generator, Python executes code in the function until it comes to a yield statement, then pauses and delivers the object. When you extract …

  3. string - What does n [::-1] means in Python? - Stack Overflow

    Feb 16, 2015 · I have a string n = "abc". I want to reverse it and found a solution like n[::-1]. What is the meaning of all 3 arguments?

  4. What does colon equal (:=) in Python mean? - Stack Overflow

    What does the := operand mean, more specifically for Python? Can someone explain how to read this snippet of code? node := root, cost = 0 frontier := priority queue containing node only explored :=

  5. python - What do ** (double star/asterisk) and * (star/asterisk) mean ...

    May 27, 2010 · See What does ** (double star/asterisk) and * (star/asterisk) do for parameters? for the complementary question about parameters. See What do ** (double star/asterisk) and * …

  6. slice - How slicing in Python works - Stack Overflow

    What really annoys me is that python says that when you don't set the start and the end, they default to 0 and the length of sequence. So, in theory, when you use "abcdef" [::-1] it should be transformed to …

  7. python - What does the argument newline='' do in the open function ...

    May 18, 2020 · I was learning Python in Codecademy and they were talking about using the open() function for CSV files. I couldn't really understand what the argument newline='' meant for the code.

  8. Python, Scikit-learn, K-means: What does the parameter n_init actually …

    Sep 22, 2017 · Closed 8 years ago. I'm a beginner for Python. Now, I'm trying to understand what the parameter n_init from sklearn.cluster.KMeans From the documentation: n_init : int, default: 10 …

  9. python - What does if __name__ == "__main__": do? - Stack Overflow

    Jan 7, 2009 · If you are trying to close a question where someone should be using this idiom and isn't, consider closing as a duplicate of Why is Python running my module when I import it, and how do I …

  10. What does "\r" do in the following script? - Stack Overflow

    Jan 30, 2013 · So what does "\r" do in this script and when do I use "\r" in general? Note: I know about "Carriage Return" but still could not figure out it is used in my script.