Python Forum
New to coding - Python error: TypeError: unsupported operand type(s) for -: 'str' and
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to coding - Python error: TypeError: unsupported operand type(s) for -: 'str' and
#8
(Jul-09-2018, 10:46 PM)zer0 Wrote: Umm, yes I use IDLE, is that bad?
Worth Python REPL (interactive shell) - as far as I know. Standard encoding is UTF-8 (at least, on Linux). Try your code either at repl.it or at online Jupyter notebook. Also, for a beginner, I would not recommend 3.7

(Jul-09-2018, 10:46 PM)zer0 Wrote: And how do I use UTF-8?
You set your encoding for a script by inserting into it the line I have given you above. It will set your encoding during the script execution. How to set encoding for IDLE - no idea (haven't touched it for years, never again Snooty )
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply


Messages In This Thread
RE: New to coding - Python error: TypeError: unsupported operand type(s) for -: 'str' and - by volcano63 - Jul-10-2018, 05:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  error in class: TypeError: 'str' object is not callable akbarza 2 655 Dec-30-2023, 04:35 PM
Last Post: deanhystad
  Coding error. xflyerwdavis 2 596 Oct-07-2023, 07:08 PM
Last Post: deanhystad
  Wrong type error rowan_bradley 6 1,428 Aug-07-2023, 10:44 AM
Last Post: rowan_bradley
  Type Error: Unsupported Operand jhancock 2 1,438 Jul-22-2023, 11:33 PM
Last Post: jhancock
  Coding error. Can't open directory EddieG 6 1,235 Jul-13-2023, 06:47 PM
Last Post: deanhystad
  Coding Error EddieG 2 606 Jul-09-2023, 02:59 AM
Last Post: EddieG
  boto3 - Error - TypeError: string indices must be integers kpatil 7 1,506 Jun-09-2023, 06:56 PM
Last Post: kpatil
  Error TypeError: output_type_handler() takes 2 positional arguments but 6 were given paulo79 1 2,078 Oct-17-2022, 06:29 PM
Last Post: paulo79
  TypeError: unsupported operand type(s) for +: 'dict' and 'int' nick12341234 1 9,502 Jul-15-2022, 04:04 AM
Last Post: ndc85430
  TypeError: unsupported opperand type(s) for %: 'int' and 'list' cool_person 7 2,340 May-07-2022, 08:40 AM
Last Post: ibreeden

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020