Inconsistent print formatting using .format() in Jupiter notebook
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
I use this return statement twice in my class definition, in two different methods. When the methods run they print differently. One creates a new line at the '\n' and the other prints out the '\n' like a string. I copied the code into an online IDE and got the correct result from that.
In:
`def __str__(self):
return '{0:<16}{1:>20}\n{2:<16}{3:>20}'.format('Account Owner:', self.owner, 'Account Balance:', self.balance)`
Out1:
Account Owner: Jose
Account Balance: 100
Out2:
'Withdrawal Amount: Jose\nNew Account Balance: 75'
Contributor guide
Research direction
No repository file, test, or entry point is identified. Start by reproducing the two class methods in Jupyter Notebook and compare how their returned strings are displayed; done means determining whether the discrepancy is notebook rendering behavior or an issue in the reported formatting path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100