Showing posts with label today I learned. Show all posts
Showing posts with label today I learned. Show all posts

Saturday, June 17, 2017

Summer of code 2017: SyntaxError: Missing parentheses in call to 'print'


As explained in my Summer of code 2017: Python post I decided to pick up Python

I looked at some examples and when I tried to run them I was getting an error

It was a pretty simple print statement

print 'Hello world'

Running that produced an error


Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> print 'Hello world'
SyntaxError: Missing parentheses in call to 'print'

It tuns out, the example I was looking at was for Python 2. In Python 2, print was a distinct statement, in Python 3 print is actually a function call. Function calls require parentheses

If I changed the print statement to the following by adding parentheses.

>>> print ('Hello world')
Hello world

Running that worked fine.

Maybe this will help some other poor soul in the future......

Monday, February 15, 2016

Started a Today I learned project on Github



I started my own Today I learned project on Github



Today I learned

A collection of concise write-ups on small things I learn day to day across a variety of languages and technologies. These are things that don't really warrant a full blog post. Idea stolen from jbranchaud/til


You can find that project here https://github.com/SQLMenace/til
The reason I did this is because it gives me an opportunity to use Github, all my stuff is usually backend SQL Server code, I also don't do any web or app programming. The reason I like the Today I Learned project is that you can easily see all the stuff that you have learned over time. I will probably mostly add R and Powershell items in the foreseeable future. I am messing mostly with R on my own time and Powershell at work. Once I start diving deeper into SQL Server 2016, I will probably add that stuff as well to my Today I Learned Github project.

What do you think... cool idea or not?


Again, you can find that project here https://github.com/SQLMenace/til