Since years are in the foreseeable future always 4 characters long, you can simply split at the 4th character like this:
s = '20181'
year, quarter = s[:4], s[4:]
# You can now use year and quarter separately or merge them back in the given format:
print(year + 'Q' + quarter)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…