diff --git a/README.md b/README.md index 89728918c74cb6721fedba926bb81dfd6492f6b7..3d52f27d0745820b4d4a6089cf25ebbee5652900 100644 --- a/README.md +++ b/README.md @@ -63,15 +63,12 @@ following command: ``` -git reset --hard HEAD +git stash save git pull origin master +git stash pop ``` -> Note that this will overwrite any changes that you have made to the -> files in your repository! - - Have fun! diff --git a/getting_started/02_text_io.ipynb b/getting_started/02_text_io.ipynb index a6333b9bd2166f98d9592727eaa1179a1a7ebd62..43ef0db4be79d6820bdd4e19e953e73f6bb0c53b 100644 --- a/getting_started/02_text_io.ipynb +++ b/getting_started/02_text_io.ipynb @@ -532,8 +532,8 @@ "outputs": [], "source": [ "a_string = 'abcdefghijklmnopqrstuvwxyz'\n", - "print(a_string[10]) # create a string containing only the 10th character\n", - "print(a_string[20:]) # create a string containing the 20th character onward\n", + "print(a_string[10]) # create a string containing only the 11th character\n", + "print(a_string[20:]) # create a string containing the 21st character onward\n", "print(a_string[::-1]) # creating the reverse string" ] }, @@ -654,8 +654,8 @@ "source": [ "### String formatting and regular expressions\n", "Given a template for MRI files:\n", - "s<subject_id>/<modality>_<res>mm.nii.gz\n", - "where <subject_id> is a 6-digit subject-id, <modality> is one of T1w, T2w, or PD, and <res> is the resolution of the image (up to one digits behind the dot, e.g. 1.5)\n", + "`s<subject_id>/<modality>_<res>mm.nii.gz`\n", + "where `<subject_id>` is a 6-digit subject-id, `<modality>` is one of T1w, T2w, or PD, and `<res>` is the resolution of the image (up to one digits behind the dot, e.g. 1.5)\n", "Write a function that takes the subject_id (as an integer), the modality (as a string), and the resolution (as a float) and returns the complete filename (Hint: use one of the formatting techniques mentioned in [String formatting](#string-formatting))." ] }, diff --git a/getting_started/02_text_io.md b/getting_started/02_text_io.md index efc40b981b6595743ba99722dca923339e03adf7..afab42f8e05d1f2029d26ff4031ca1578b97394c 100644 --- a/getting_started/02_text_io.md +++ b/getting_started/02_text_io.md @@ -243,8 +243,8 @@ This code block will fail in fslpython, since it uses python 3.5. The simplest way to extract a sub-string is to use slicing ``` a_string = 'abcdefghijklmnopqrstuvwxyz' -print(a_string[10]) # create a string containing only the 10th character -print(a_string[20:]) # create a string containing the 20th character onward +print(a_string[10]) # create a string containing only the 11th character +print(a_string[20:]) # create a string containing the 21st character onward print(a_string[::-1]) # creating the reverse string ``` @@ -306,8 +306,8 @@ with open(output_filename, 'w') as output_file: ### String formatting and regular expressions Given a template for MRI files: -s<subject_id>/<modality>_<res>mm.nii.gz -where <subject_id> is a 6-digit subject-id, <modality> is one of T1w, T2w, or PD, and <res> is the resolution of the image (up to one digits behind the dot, e.g. 1.5) +`s<subject_id>/<modality>_<res>mm.nii.gz` +where `<subject_id>` is a 6-digit subject-id, `<modality>` is one of T1w, T2w, or PD, and `<res>` is the resolution of the image (up to one digits behind the dot, e.g. 1.5) Write a function that takes the subject_id (as an integer), the modality (as a string), and the resolution (as a float) and returns the complete filename (Hint: use one of the formatting techniques mentioned in [String formatting](#string-formatting)). ``` def get_filename(subject_id, modality, resolution): @@ -320,4 +320,3 @@ def get_parameters(filename): ... return subject_id, modality, resolution ``` -