Python Forum
Best Practice For String Quotations ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best Practice For String Quotations ?
#3
(Aug-31-2017, 04:12 PM)Zork_3 Wrote: I would like to know is there a standard that most Of you use ?
PEP8.org (Better CSS styled pep-8 website).
String Quotes 
Quote:In Python, single-quoted strings and double-quoted strings are the same.
This PEP does not make a recommendation for this.
Pick a rule and stick to it.
When a string contains single or double quote characters, however, use the other one to avoid backslashes in the string.
It improves readability.
For triple-quoted strings, always use double quote characters to be consistent with the docstring convention in PEP 257.

Zork_3 Wrote:It seems to me that double quotes would be best
My rule is that i always use single quotes,easier to type and i think it look better Wink
Reply


Messages In This Thread
Best Practice For String Quotations ? - by Zork_3 - Aug-31-2017, 04:12 PM
RE: Best Practice For String Quotations ? - by snippsat - Aug-31-2017, 04:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how can I organise my code : best practice? pythonbum 0 67 Yesterday, 03:17 PM
Last Post: pythonbum
  Threading best practice EvanS1 2 2,001 Apr-21-2020, 10:11 PM
Last Post: EvanS1
  Help with string practice Hermann_Fegelein 2 2,759 Aug-15-2018, 04:56 PM
Last Post: Hermann_Fegelein

Forum Jump:

User Panel Messages

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