Labels

Aws (32) MySQL (20) Aurora (12) Rds (7) DynamoDB (6) Cloudformation (4) Python3 (4) Unix (3) MongoDB (1)

Wednesday, 6 December 2017

Python3 - Install & Variables

Python language is now highly demanded and being a good Python developer or basic at least is an important skill. Python 3 is being widely used and I made my mind up to get on with this version. As environment I use a Ubuntu 16.04

Installation

sudo apt-get install python3-pip
sudo pip3 install boto3 
boto3 is the SDK for AWS, it has the classes that will let me connect to the Aws resources
Script header
#!/usr/bin/env python3
print(sys.version)

Variables & Modules

server = 'localhost'
default_file = "~/my.cfn"
print('This is the server => ' + server)
mysql_quick_access='mysql --defaults-file=' + default_file + '-h ' + server + ' -sN'
Guidance for the variables and style can be found PEP-8
Tips
  • If you forget a '+' between two strings, a SyntaxError is raised.
  • To print a new line in a string using the '\n'